import { createElement as h, CSSProperties, FC } from "react";

type PropsType = {
  text: string;
  level: number;
  isCenter?: boolean;
};

const QuestionTitle: FC<PropsType> = ({ text, level, isCenter }) => {
  const style: CSSProperties = {};
  if (isCenter) style.textAlign = "center";

  return h(
    `h${level}`,
    {
      style,
    },
    [text]
  );
};

export default QuestionTitle;
